﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/ADAdminLayout.master" AutoEventWireup="true" CodeFile="binh_luan.aspx.cs" Inherits="admin_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="block" id="block-lists">
        <div class="content">
            <h2 class="title">
                Bình luận</h2>
            <div class="inner">
                <div class="group">
                    <label>
                        Từ khóa:&nbsp;
                    </label>
                    <asp:TextBox ID="TextBox1" runat="server" class="text_field" size="60"></asp:TextBox>
                    &nbsp;
                    <button class="button slim-button" type="submit">
                        <img src="./images/search.png" alt="Tìm kiếm">
                        Tìm kiếm</button>
                </div>
                <br />
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                    AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSourceKhuyenMai"
                    CssClass="table" >
                    <Columns>
                        <asp:BoundField DataField="id" HeaderText="id" SortExpression="id" 
                            InsertVisible="False" ReadOnly="True" />
                        <asp:BoundField DataField="ho_ten" HeaderText="Người đăng" 
                            SortExpression="ho_ten" />
                        <asp:BoundField DataField="ten_sp" HeaderText="Tên khuyến mãi" 
                            SortExpression="ten_sp" />
                        <asp:BoundField DataField="noi_dung" HeaderText="Nội dung" 
                            SortExpression="noi_dung" />
                        <asp:HyperLinkField DataNavigateUrlFields="id" 
                            DataNavigateUrlFormatString="xoa_binh_luan.aspx?id={0}" Text="Xoá" />
                       
                        <asp:CommandField ShowDeleteButton="True" />
                       
                    </Columns>
                    
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSourceKhuyenMai" runat="server" ConnectionString="<%$ ConnectionStrings:babydealConnectionString %>"
                    
                    
                    SelectCommand="SELECT binh_luan.id, binh_luan.id_khuyen_mai, binh_luan.id_thanh_vien, binh_luan.noi_dung, thanh_vien.ho_ten, khuyen_mai.ten_sp FROM binh_luan INNER JOIN khuyen_mai ON binh_luan.id_khuyen_mai = khuyen_mai.id INNER JOIN thanh_vien ON binh_luan.id_thanh_vien = thanh_vien.id WHERE (binh_luan.noi_dung LIKE N'%' + @ten_sp + N'%')" 
                    DeleteCommand="DELETE FROM [binh_luan] WHERE [id] = @id">
                    <DeleteParameters>
                        <asp:Parameter Name="id"/>
                    </DeleteParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="TextBox1" DefaultValue="%%" Name="ten_sp" 
                            PropertyName="Text" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <br />
            </div>
        </div>
    </div>
    </asp:Content>

